home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / NET / LLC.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  4KB  |  136 lines

  1. #include <linux/skbuff.h>
  2.  
  3. #define LLC_MODULE
  4.  
  5. typedef struct llc_struct llc;
  6. typedef struct llc_struct *llcptr;
  7.  
  8. /*
  9.  *    LLC private data area structure.
  10.  */
  11.  
  12. struct llc_struct
  13.     char eye[4];            /* To recognize llc area in dump */
  14.     int retry_count;        /* LLC link state variables */
  15.     unsigned char name[9];        /* name of this llc instance */
  16.     unsigned char s_flag;
  17.     unsigned char p_flag;
  18.     unsigned char f_flag;
  19.     unsigned char data_flag;
  20.     unsigned char cause_flag;
  21.     unsigned char vs;        /* Send state variable */
  22.     unsigned char vr;        /* Receive state variable */
  23.     unsigned char remote_busy;
  24.     unsigned char state;        /* Current state of type2 llc procedure */
  25.     int n1;                /* Maximum number of bytes in I pdu 7.8.2 */
  26.     int n2;                /* Naximum number of retransmissions 7.8.2 */
  27.     unsigned char k;        /* Transmit window size 7.8.4, tw in IBM doc*/ 
  28.     unsigned char rw;        /* Receive window size */
  29.     struct 
  30.     {                     
  31.         /*
  32.          *    FRMR_RSP info field structure: 5.4.2.3.5 p55
  33.          */
  34.  
  35.         unsigned char cntl1;
  36.         unsigned char cntl2;
  37.         unsigned char vs;
  38.         unsigned char vr_cr;
  39.         unsigned char xxyz;
  40.     } frmr_info_fld;
  41.  
  42.     /*
  43.      *    Timers in 7.8.1 page 78 
  44.      */
  45.  
  46. #define P_TIMER         0
  47. #define REJ_TIMER       1
  48. #define ACK_TIMER       2 
  49. #define BUSY_TIMER      3
  50.     unsigned long timer_expire_time[4];    
  51.     unsigned char timer_state[4];    /* The state of each timer */
  52. #define TIMER_IDLE      0
  53. #define TIMER_RUNNING   1
  54. #define TIMER_EXPIRED   2
  55.     unsigned long timer_interval[4]; 
  56.     struct timer_list tl[4];
  57.  
  58.     /* 
  59.      *    Client entry point, called by the LLC.
  60.      */
  61.      
  62.     void    (*llc_event)(struct llc_struct *);
  63.     
  64.     /*
  65.      *    Mux and Demux variables
  66.      */
  67.      
  68.     char * client_data;        /* Pointer to clients context */
  69.     unsigned char local_sap;
  70.     unsigned char remote_sap ;
  71.     char remote_mac[MAX_ADDR_LEN];  /* MAC address of remote session partner */ 
  72.     struct device *dev;        /* Device we are attached to */
  73.              
  74.     unsigned char llc_mode;        /* See doc 7.1 on p70 */
  75. #define MODE_ADM 1
  76. #define MODE_ABM 2
  77.  
  78.     int llc_callbacks;        /* Pending callbacks */
  79. #define LLC_CONN_INDICATION    1    /* We have to ensure the names don't */
  80. #define LLC_CONN_CONFIRM    2    /* mix up with the 802 state table */
  81. #define LLC_DATA_INDIC        4
  82. #define LLC_DISC_INDICATION    8
  83. #define LLC_RESET_INDIC_LOC    16
  84. #define LLC_RESET_INDIC_REM    32
  85. #define LLC_RST_CONFIRM        64
  86. #define LLC_FRMR_RECV        128
  87. #define LLC_FRMR_SENT        256
  88. #define LLC_REMOTE_BUSY        512
  89. #define LLC_REMOTE_NOTBUSY    1024
  90. #define LLC_TEST_INDICATION    2048
  91. #define LLC_XID_INDICATION    4096
  92. #define LLC_UI_DATA        8192
  93.  
  94.     struct sk_buff *inc_skb;    /* Saved data buffer for indications */
  95.     
  96.     struct sk_buff_head rtq;    /* Retransmit queue */
  97.     struct sk_buff_head atq;    /* Await transit queue */
  98.       
  99.     unsigned char xid_count;
  100.  
  101.     struct llc_struct *nextllc;    /* ptr to next llc struct in proto chain */
  102. };
  103.  
  104. #define ADD_TO_RTQ(skb) skb_queue_tail(&lp->rtq,skb)
  105. #define ADD_TO_ATQ(skb) skb_queue_tail(&lp->atq,skb)
  106.  
  107. void         llc_cancel_timers(llcptr lp);
  108. int        llc_decode_frametype(frameptr fr);
  109. llcptr         llc_find(void);
  110. int        llc_free_acknowledged_skbs(llcptr lp, unsigned char ack);
  111. void        llc_handle_xid_indication( char *chsp, short int ll, char *xid_data);
  112. void        llc_interpret_pseudo_code(llcptr lp, int pc_label, struct sk_buff *skb, char type);
  113. void        llc_add_to_queue(struct sk_buff *skb, struct sk_buff **f, struct sk_buff **b);
  114. void        llc_process_otype2_frame(llcptr lp, struct sk_buff *skb, char type);
  115. struct sk_buff *llc_pull_from_atq(llcptr lp); 
  116. int         llc_resend_ipdu(llcptr lp, unsigned char ack_nr, unsigned char type, char p);
  117. void         llc_sendpdu(llcptr lp, char type, char pf, int data_len, char *pdu_data);
  118. void         llc_sendipdu(llcptr lp, char type, char pf, struct sk_buff *skb);
  119. void        llc_start_timer(llcptr lp, int t);
  120. void        llc_stop_timer(llcptr lp, int t);
  121. void        llc_timer_expired(llcptr lp, int t);
  122. int        llc_validate_seq_nos(llcptr lp, frameptr fr);
  123.  
  124. int        llc_data_request(llcptr lp, struct sk_buff *skb);
  125. void        llc_unit_data_request(llcptr lp, int ll, char * data);
  126. void        llc_disconnect_request(llcptr lp);
  127. void        llc_connect_request(llcptr lp);
  128. void        llc_xid_request(llcptr lp, char opt, int data_len, char *pdu_data);
  129. void        llc_test_request(llcptr lp, int data_len, char *pdu_data);
  130.  
  131. int        register_cl2llc_client(llcptr llc, const char *device, void (*ops)(llcptr), u8 *rmac, u8 ssap, u8 dsap);
  132. void        unregister_cl2llc_client(llcptr lp);
  133. int         llc_mac_data_indicate(llcptr lp, struct sk_buff *skb );
  134.  
  135.